<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><s:text name="context.title"/></title>
<%@ include file="/common/meta.jsp"%>
  <link rel="stylesheet" href="${ctx}/js/cluetip/jquery.cluetip.css" type="text/css" />

<script src="${ctx}/js/cluetip/jquery.cluetip.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">

          var pageTotalPages = "1";
          var pageNo = "";
        $(document).ready(function() {
        	
        	  $('.cluetip-link').cluetip({sticky: true,width:500, closePosition: 'title', arrows: true,ajaxCache:false});
        	var pageTotalPages = $("#pageTotalPages").val();
            var pageNo = $("#pageNo").val();
            $("#pager").pager({ pagenumber: pageNo, pagecount: pageTotalPages, buttonClickCallback: PageClick });
            
        });

        PageClick = function(pageclickednumber) {
            $("#pager").pager({ pagenumber: pageclickednumber, pagecount: pageTotalPages, buttonClickCallback: PageClick });
           // $("#result").html("Clicked Page " + pageclickednumber);
            jumpPage(pageclickednumber);
        }
        
        function chex(obj){
            $("#cnt").hide();
            $("#cnt").val("");
            $("#pecent").hide();
            $("#pecent").val("");
			if($(obj).val() == "1"){
				$("#pecent").show();
			}else{
				$("#cnt").show();
			}
        }

        function checkForm(){
			var percent = $("#percent").val();
			var cnt = $("#cnt").val();
			if(cnt == "" && percent == ""){
				alert("至少输入一个");
				return false;
			}
			return true;
        }
        function chx(obj){
			if(obj.checked){
				$(".chx").attr("checked","checked");
			}else{
				$(".chx").removeAttr("checked");
			}
        }	

        var idTmr = "";
        function exp2(tableid) //读取表格中每个单元到EXCEL中 
        { 
            var curTbl = document.getElementById(tableid); 
            var oXL;
             try {
             	oXL = new ActiveXObject("Excel.Application"); 
           	  //插件初始化失败时作出提示
           	 }catch (e) {
           	  alert("无法启动Excel!\n\n如果您确信您的电脑中已经安装了Excel，"+"那么请调整IE的安全级别。\n\n具体操作：\n\n"+"工具 → Internet选项 → 安全 → 可信站点 →站点 →输入本网站的域名或IP地址 →添加 →关闭 → 自定义级别 → 对没有标记为安全的ActiveX进行初始化和脚本运行 → 启用 ");	
           	  return false;
           	 }
             //创建AX对象excel 
             var oWB = oXL.Workbooks.Add(); 
             //获取workbook对象 
            var oSheet = oWB.ActiveSheet; 
            //激活当前sheet 
             var Lenr = curTbl.rows.length; 
             //取得表格行数 
             for (i = 0; i < Lenr; i++) 
             { 
                 var Lenc = curTbl.rows(i).cells.length; 
                 //取得每行的列数 
                 for (j = 0; j < Lenc; j++) 
                 { 
                     oSheet.Cells(i + 1, j + 1).value = curTbl.rows(i).cells(j).innerText; 
                     //赋值 
                 } 
             } 
             oXL.Visible = true; 
             //设置excel可见属性
            oXL.Quit();
            oXL = null;
             // 调用Cleanup（）进行垃圾回收
             idTmr = window.setInterval("Cleanup();",10);
        }
        function Cleanup() {
            window.clearInterval(idTmr);
            CollectGarbage();
  		}
    </script>
</head>
<body>
<form action="spot-check" method="post" id="main">
<br/>
<p align="center"><s:actionmessage theme="mytheme" cssClass="actionMessage"/></p>
<h1 class="title01"><img src="${ctx}/images/02_15.gif" width="45" height="42" class="fl"/>抽查答辩学生</h1>
<fieldset class="fs_ys" style="width: 690px">
<legend>抽查</legend>
<s:if test="#request.lisfdas == null || #request.lisfdas.size() == 0">
<table align="center" id="contentTable" class="table_ys_input" >
	<tr>
		<td nowrap="nowrap">抽查方式&nbsp;</td>
		<td nowrap="nowrap">
			<input type="radio" name="mode" value="1" checked="checked" onclick="chex(this)" />百分比  
			<input type="radio" name="mode" value="0" onclick="chex(this)"/>
		&nbsp;</td>
		<td nowrap="nowrap">人数或百分比&nbsp;</td>
		<td colspan="" nowrap="nowrap">
			<select  name="percent" id="pecent">
				<option value="">请选择</option>
				<option value="10">10%</option>
				<option value="20">20%</option>
				<option value="30">30%</option>
				<option value="40">40%</option>
				<option value="50">50%</option>
				<option value="60">60%</option>
				<option value="70">70%</option>
				<option value="80">80%</option>
				<option value="90">90%</option>
				<option value="100">100%</option>
			</select>
			<input style="display: none;width: 40px" type="text" name="cnt" id="cnt"/>
			(现参加毕业设计(论文)的学生有${size }人)
		&nbsp;</td>
		
		<td>
		<center>
		<tc:timeControler authName="中 期">
			<input type="submit"  value="     查询 "  name="method:spotCheck" onclick="return checkForm()"/>
		</tc:timeControler>	
		</center>
		</td>		
	</tr>
</table>
</s:if>
<s:else>
	已确定抽查名单
</s:else>
</fieldset>

<s:if test="#request.lisfdas.size()!=0">
<table id="contentTable1" class="table_ys tableColor table_ys_input">
	<tr>
		<th nowrap="nowrap" colspan="">序号</th>
		<th nowrap="nowrap">题目</th>
		<th nowrap="nowrap">教师名称</th>
		<th nowrap="nowrap">教师职称</th>
		<th nowrap="nowrap">学生姓名</th>
		<th nowrap="nowrap">学号</th>
	</tr>
	<s:iterator value="#request.lisfdas" var="v" status="st">
	<tr>
		<td>${st.index + 1 }&nbsp;</td>
		<td>${titile }&nbsp;</td>
		<td>${teacherName }&nbsp;</td>
		<td>${teacherPost }&nbsp;</td>
		<td>${studentName }&nbsp;</td>
		<td>${studentNo }&nbsp;</td>
	</tr>
	</s:iterator>
	<tr>
		<td colspan="7">
<center><input type="button" onclick="exp2('contentTable1')" value="导出抽查学生名单"/></center>
		&nbsp;</td>
	</tr>
</table>
</s:if>
<s:elseif test="listAll != null && listAll.size() != 0">
<table id="contentTable1" class="table_ys tableColor table_ys_input">
	<tr>
		<th nowrap="nowrap" colspan="">序号</th>
		<th class="hid" nowrap="nowrap"><input type="checkbox"  checked="checked" onclick="chx(this)"/></th>
		<th nowrap="nowrap">题目</th>
		<th nowrap="nowrap">教师名称</th>
		<th nowrap="nowrap">教师职称</th>
		<th nowrap="nowrap">学生姓名</th>
		<th nowrap="nowrap">学号</th>
	</tr>
	<s:iterator value="listAll" var="v" status="st">
	<tr>
		<td>${st.index + 1 }&nbsp;</td>
		<td class="hid"><input type="checkbox" checked="checked" name="checkedId" value="${v.id }" class="chx"/>&nbsp;</td>
		<td>${titile }&nbsp;</td>
		<td>${teacherName }&nbsp;</td>
		<td>${teacherPost }&nbsp;</td>
		<td>${studentName }&nbsp;</td>
		<td>${studentNo }&nbsp;</td>
	</tr>
	</s:iterator>
	<s:if test="#request.list == null || #request.list.size() == 0">
	<tr>
		<td colspan="7">
<center>	<tc:timeControler authName="中 期"><input type="submit" value="确定抽查学生名单" name="method:confirmStudent" onclick="return confirm('确定提交？')"/></tc:timeControler>  <input type="button" onclick="exp2('contentTable1')" value="导出抽查学生名单"/></center>
		</td>
	</tr>
	</s:if>
</table>
</s:elseif>
</form>
</body>

</html>